

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>aiy.voice.tts &mdash; AIY Projects 2018-11-16 documentation</title>
  

  
  
  
  

  
  <script type="text/javascript" src="_static/js/modernizr.min.js"></script>
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
        <script src="_static/jquery.js"></script>
        <script src="_static/underscore.js"></script>
        <script src="_static/doctools.js"></script>
        <script src="_static/language_data.js"></script>
    
    <script type="text/javascript" src="_static/js/theme.js"></script>

    

  
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="_static/custom.css" type="text/css" />
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="prev" title="aiy.voice.audio" href="aiy.voice.audio.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="index.html" class="icon icon-home"> AIY Projects
          

          
          </a>

          
            
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <p class="caption"><span class="caption-text">Common APIs</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="aiy.board.html">aiy.board</a></li>
<li class="toctree-l1"><a class="reference internal" href="aiy.leds.html">aiy.leds</a></li>
<li class="toctree-l1"><a class="reference internal" href="aiy.pins.html">aiy.pins</a></li>
</ul>
<p class="caption"><span class="caption-text">Vision Kit APIs</span></p>
<ul>
<li class="toctree-l1"><a class="reference internal" href="vision.html">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="aiy.toneplayer.html">aiy.toneplayer</a></li>
<li class="toctree-l1"><a class="reference internal" href="aiy.trackplayer.html">aiy.trackplayer</a></li>
<li class="toctree-l1"><a class="reference internal" href="aiy.vision.annotator.html">aiy.vision.annotator</a></li>
<li class="toctree-l1"><a class="reference internal" href="aiy.vision.inference.html">aiy.vision.inference</a></li>
<li class="toctree-l1"><a class="reference internal" href="aiy.vision.models.html">aiy.vision.models</a></li>
</ul>
<p class="caption"><span class="caption-text">Voice Kit APIs</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="voice.html">Overview</a></li>
<li class="toctree-l1"><a class="reference internal" href="aiy.assistant.html">aiy.assistant</a></li>
<li class="toctree-l1"><a class="reference internal" href="aiy.cloudspeech.html">aiy.cloudspeech</a></li>
<li class="toctree-l1"><a class="reference internal" href="aiy.voice.audio.html">aiy.voice.audio</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">aiy.voice.tts</a></li>
</ul>
<p class="caption"><span class="caption-text">Other docs</span></p>
<ul>
<li class="toctree-l1"><a class="reference external" href="https://github.com/google/aiyprojects-raspbian">Source code (GitHub)</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/google/aiyprojects-raspbian/blob/aiyprojects/CHANGES.md">Change log (GitHub)</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/google/aiyprojects-raspbian/blob/aiyprojects/HACKING.md">Software setup (GitHub)</a></li>
<li class="toctree-l1"><a class="reference external" href="https://github.com/google/aiyprojects-raspbian/blob/aiyprojects/CONTRIBUTING.md">Contribution guide (GitHub)</a></li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">AIY Projects</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html">Docs</a> &raquo;</li>
        
      <li>aiy.voice.tts</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/aiy.voice.tts.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="module-aiy.voice.tts">
<span id="aiy-voice-tts"></span><h1>aiy.voice.tts<a class="headerlink" href="#module-aiy.voice.tts" title="Permalink to this headline">¶</a></h1>
<p>An API that performs text-to-speech.</p>
<p>You can also use this to perform text-to-speech from the command line:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">python</span> <span class="o">~/</span><span class="n">AIY</span><span class="o">-</span><span class="n">projects</span><span class="o">-</span><span class="n">python</span><span class="o">/</span><span class="n">src</span><span class="o">/</span><span class="n">aiy</span><span class="o">/</span><span class="n">voice</span><span class="o">/</span><span class="n">tts</span><span class="o">.</span><span class="n">py</span> <span class="s2">&quot;hello world&quot;</span>
</pre></div>
</div>
<dl class="function">
<dt id="aiy.voice.tts.say">
<code class="sig-prename descclassname">aiy.voice.tts.</code><code class="sig-name descname">say</code><span class="sig-paren">(</span><em class="sig-param">text</em>, <em class="sig-param">lang='en-US'</em>, <em class="sig-param">volume=60</em>, <em class="sig-param">pitch=130</em>, <em class="sig-param">speed=100</em>, <em class="sig-param">device='default'</em><span class="sig-paren">)</span><a class="headerlink" href="#aiy.voice.tts.say" title="Permalink to this definition">¶</a></dt>
<dd><p>Speaks the provided text.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>text</strong> – The text you want to speak.</p></li>
<li><p><strong>lang</strong> – The language to use. Supported languages are:
en-US, en-GB, de-DE, es-ES, fr-FR, it-IT.</p></li>
<li><p><strong>volume</strong> – Volume level for the converted audio. The normal volume level is
100. Valid volume levels are between 0 (no audible output) and 500 (increasing the
volume by a factor of 5). Values higher than 100 might result in degraded signal
quality due to saturation effects (clipping) and is not recommended. To instead adjust
the volume output of your device, enter <code class="docutils literal notranslate"><span class="pre">alsamixer</span></code> at the command line.</p></li>
<li><p><strong>pitch</strong> – The pitch level for the voice. The normal pitch level is 100, the allowed values lie
between 50 (one octave lower) and 200 (one octave higher).</p></li>
<li><p><strong>speed</strong> – The speed of the voice. The normal speed level is 100, the allowed values lie
between 20 (slowing down by a factor of 5) and 500 (speeding up by a factor of 5).</p></li>
<li><p><strong>device</strong> – The PCM device name. Leave as <code class="docutils literal notranslate"><span class="pre">default</span></code> to use the default ALSA soundcard.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</div>


           </div>
           
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
      
        <a href="aiy.voice.audio.html" class="btn btn-neutral float-left" title="aiy.voice.audio" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2018, Google LLC

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>